[IA64] fix paravirtualization of clone2() system call.
authorawilliam@xenbuild.aw <awilliam@xenbuild.aw>
Wed, 22 Nov 2006 17:10:38 +0000 (10:10 -0700)
committerawilliam@xenbuild.aw <awilliam@xenbuild.aw>
Wed, 22 Nov 2006 17:10:38 +0000 (10:10 -0700)
If audit is enabled or the child process is ptraced,
non-paravirtualized code path is executed.
Thus paravirtualized ifs is left unmodifed so that the child process
crashes after clone2().
paravirtualize ia64_ret_from_clone() to fix it.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
linux-2.6-xen-sparse/arch/ia64/kernel/entry.S
linux-2.6-xen-sparse/arch/ia64/xen/xenentry.S
linux-2.6-xen-sparse/include/asm-ia64/privop.h
linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h

index 67738bb21dfa7c1270bb427a20d996e0b39f982a..67f37b2c536db7b5cdcfe5c1330a765badfdaa07 100644 (file)
@@ -602,7 +602,7 @@ GLOBAL_ENTRY(ia64_strace_leave_kernel)
 .ret4: br.cond.sptk ia64_leave_kernel
 END(ia64_strace_leave_kernel)
 
-GLOBAL_ENTRY(ia64_ret_from_clone)
+GLOBAL_ENTRY(__ia64_ret_from_clone)
        PT_REGS_UNWIND_INFO(0)
 {      /*
         * Some versions of gas generate bad unwind info if the first instruction of a
@@ -628,7 +628,7 @@ GLOBAL_ENTRY(ia64_ret_from_clone)
        cmp.ne p6,p0=r2,r0
 (p6)   br.cond.spnt .strace_check_retval
        ;;                                      // added stop bits to prevent r8 dependency
-END(ia64_ret_from_clone)
+END(__ia64_ret_from_clone)
        // fall through
 GLOBAL_ENTRY(ia64_ret_from_syscall)
        PT_REGS_UNWIND_INFO(0)
index bd66913f4fc7e22172f5ee9d752aa32d2fc787e5..aad0aac631842403779aa02c5248b92617cc7fa4 100644 (file)
@@ -237,6 +237,47 @@ END(xen_trace_syscall)
 END(ia64_trace_syscall)
 #endif
 
+#ifdef CONFIG_XEN
+GLOBAL_ENTRY(xen_ret_from_clone)
+       PT_REGS_UNWIND_INFO(0)
+       movl r16=running_on_xen;;
+       ld4 r16=[r16];;
+       cmp.eq p7,p0=r16,r0
+(p7)   br.cond.sptk.many __ia64_ret_from_clone;;
+#else  
+GLOBAL_ENTRY(ia64_ret_from_clone)
+       PT_REGS_UNWIND_INFO(0)
+#endif 
+{      /*
+        * Some versions of gas generate bad unwind info if the first instruction of a
+        * procedure doesn't go into the first slot of a bundle.  This is a workaround.
+        */
+       nop.m 0
+       nop.i 0
+       /*
+        * We need to call schedule_tail() to complete the scheduling process.
+        * Called by ia64_switch_to() after do_fork()->copy_thread().  r8 contains the
+        * address of the previously executing task.
+        */
+       br.call.sptk.many rp=ia64_invoke_schedule_tail
+}
+.ret8:
+       adds r2=TI_FLAGS+IA64_TASK_SIZE,r13
+       ;;
+       ld4 r2=[r2]
+       ;;
+       mov r8=0
+       and r2=_TIF_SYSCALL_TRACEAUDIT,r2
+       ;;
+       cmp.ne p6,p0=r2,r0
+(p6)   br.cond.spnt .strace_check_retval
+       ;;                                      // added stop bits to prevent r8 dependency
+#ifdef CONFIG_XEN
+       br.cond.sptk ia64_ret_from_syscall
+END(xen_ret_from_clone)
+#else
+END(ia64_ret_from_clone)
+#endif         
 /*
  * ia64_leave_syscall(): Same as ia64_leave_kernel, except that it doesn't
  *     need to switch to bank 0 and doesn't restore the scratch registers.
index 28c1e886c03ee8cdc28f78e442baa191c9837c8d..05935407eec74091f30ef8b04394800b39e7693c 100644 (file)
@@ -49,6 +49,7 @@
 #define ia64_leave_kernel              __ia64_leave_kernel
 #define ia64_leave_syscall             __ia64_leave_syscall
 #define ia64_trace_syscall             __ia64_trace_syscall
+#define ia64_ret_from_clone            __ia64_ret_from_clone
 #define ia64_switch_to                 __ia64_switch_to
 #define ia64_pal_call_static           __ia64_pal_call_static
 
index 6f3c20a8eda0c52ab6d12a795f8e85602e9c679e..a2615ca7e733424a77f9cff7cd9461e64f4a2aac 100644 (file)
@@ -295,6 +295,7 @@ extern void xen_ptcga(unsigned long addr, unsigned long size);
 #define        ia64_leave_kernel               xen_leave_kernel
 #define        ia64_leave_syscall              xen_leave_syscall
 #define        ia64_trace_syscall              xen_trace_syscall
+#define        ia64_ret_from_clone             xen_ret_from_clone
 #define        ia64_switch_to                  xen_switch_to
 #define        ia64_pal_call_static            xen_pal_call_static